/**************************************************************************
 *         Copyright(c) 2007 by Sunplus mMedia  Technology Co., Ltd.       *
 *                                                                         *
 *  This software is copyrighted by and is the property of Sunplus mMedia  *
 *  Technology Co., Ltd. All rights are reserved by Sunplus mMedia Techno- *
 *  logy Co., Ltd. This software may only be used in accordance with the   *
 *  corresponding license agreement. Any unauthorized use, duplication,    *
 *  distribution, or disclosure of this software is expressly forbidden.   *
 *                                                                         *
 *  This Copyright notice "M U S T" not be removed or modified without     *
 *  prior written consent of Sunplus mMedia Technology  Co., Ltd.          *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd. reserves the right to modify this  *
 *  software without notice.                                               *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd.                                    *
 *  19-1, Innovation First Road, Science-Based Industrial Park,            *
 *  Hsin-Chu, Taiwan, R.O.C.                                               *
 *                                                                         *
 **************************************************************************/
#ifndef __OS_MSG_H__
#define __OS_MSG_H__

#include "app_msg.h"

/**************************************************************************
 *                           C O N S T A N T S                            *
 **************************************************************************/

/**************************************************************************
 *                              M A C R O S                               *
 **************************************************************************/

/**************************************************************************
 *                          D A T A    T Y P E S                          *
 **************************************************************************/
typedef struct MainMsgQue_s
{
	struct MainMsgQue_s* pQue;
	UINT8* QueStart;
	UINT8* QueEnd;
	UINT8* QueIn;
	UINT8* QueOut;
	UINT8 QueEntries;
	UINT8 QueSize;
} MainMsgQue_t;

typedef enum {
	SP1K_MSG_NULL = 0x00,
		
	/* mode switch msg */
	
	SP1K_MSG_STATE_INIT = 0x01,
	SP1K_MSG_STATE_TO_POWER_ON = 0x02,
	SP1K_MSG_STATE_TO_STILL_VIEW = 0x03, 
	SP1K_MSG_STATE_TO_VIDEO_VIEW = 0x04, 
	SP1K_MSG_STATE_TO_AUDIO_REC = 0x05,
	SP1K_MSG_STATE_TO_STILL_PLAY = 0x06, 
	SP1K_MSG_STATE_TO_MULTI_PLAY = 0x07, 
	SP1K_MSG_STATE_TO_VIDEO_PLAY = 0x08,
	SP1K_MSG_STATE_TO_AUDIO_PLAY = 0x09,
	SP1K_MSG_STATE_TO_MENU = 0x0a, 
	SP1K_MSG_STATE_TO_USB = 0x0b, 
	SP1K_MSG_STATE_TO_SLIDE_SHOW = 0x0c, 
	SP1K_MSG_STATE_TO_PAN_SHOW = 0x0d, 
	SP1K_MSG_STATE_TO_CAL_MENU = 0x0e,

	SP1K_MSG_STATE_MAX = 0x0f,
	
	/* ui key msg */	
	
	SP1K_MSG_KEY_PRESS_S1 = 0x10,
	SP1K_MSG_KEY_PRESS_S2 = 0x11, 
	SP1K_MSG_KEY_PRESS_MENU = 0x12, 
	SP1K_MSG_KEY_PRESS_UP = 0x13, 
	SP1K_MSG_KEY_PRESS_DOWN = 0x14, 
	SP1K_MSG_KEY_PRESS_LEFT = 0x15, 
	SP1K_MSG_KEY_PRESS_RIGHT = 0x16, 
	SP1K_MSG_KEY_PRESS_OK = 0x17, 
	SP1K_MSG_KEY_PRESS_TELE = 0x18, 
	SP1K_MSG_KEY_PRESS_WIDE = 0x19, 
	SP1K_MSG_KEY_PRESS_DISP = 0x1a, 
	SP1K_MSG_KEY_PRESS_F1 = 0x1b,
	SP1K_MSG_KEY_PRESS_F2 = 0x1c,
	SP1K_MSG_KEY_PRESS_PB = 0x1d,
	SP1K_MSG_KEY_PRESS_POWER = 0x1e,
	SP1K_MSG_KEY_PRESS_MAX = 0x1f,
	
	SP1K_MSG_KEY_RELEASE_S1 = 0x20, 
	SP1K_MSG_KEY_RELEASE_S2 = 0x21, 
	SP1K_MSG_KEY_RELEASE_MENU = 0x22, 
	SP1K_MSG_KEY_RELEASE_UP = 0x23, 
	SP1K_MSG_KEY_RELEASE_DOWN = 0x24, 
	SP1K_MSG_KEY_RELEASE_LEFT = 0x25, 
	SP1K_MSG_KEY_RELEASE_RIGHT = 0x26, 
	SP1K_MSG_KEY_RELEASE_OK = 0x27, 
	SP1K_MSG_KEY_RELEASE_TELE = 0x28, 
	SP1K_MSG_KEY_RELEASE_WIDE = 0x29, 
	SP1K_MSG_KEY_RELEASE_DISP = 0x2a,
	SP1K_MSG_KEY_RELEASE_F1 = 0x2b,
	SP1K_MSG_KEY_RELEASE_F2 = 0x2c,
	SP1K_MSG_KEY_RELEASE_PB = 0x2d,
	SP1K_MSG_KEY_RELEASE_POWER = 0x2e,
	SP1K_MSG_KEY_RELEASE_MAX = 0x2f,
	
	SP1K_MSG_KEY_REPEATE_UP = 0x30, 
	SP1K_MSG_KEY_REPEATE_DOWN = 0x31, 
	SP1K_MSG_KEY_REPEATE_LEFT = 0x32, 
	SP1K_MSG_KEY_REPEATE_RIGHT = 0x33, 
	SP1K_MSG_KEY_REPEATE_TELE = 0x34, 
	SP1K_MSG_KEY_REPEATE_WIDE = 0x35,
	SP1K_MSG_KEY_REPEATE_MAX = 0x3e,

	SP1K_MSG_KEY_MAX = 0x3f,

	/* GPIO msg */
	
	SP1K_MSG_CARD_PLUG_IN = 0x40, 
	SP1K_MSG_CARD_PLUG_OUT = 0x41, 
	SP1K_MSG_USB_PLUG_IN = 0x42, 
	SP1K_MSG_USB_PLUG_OUT = 0x43, 
	SP1K_MSG_TV_PLUG_IN = 0x44, 
	SP1K_MSG_TV_PLUG_OUT = 0x45,
	SP1K_MSG_BAT_LV_UPDATE = 0x46,
	SP1K_MSG_BAT_EMPTY = 0x47,

	/* RS232 msg */
	
	SP1K_MSG_RS232_CMD = 0x50,
	SP1K_MSG_UART_CMD = 0x51,
       
	/* power msg */
	
	SP1K_MSG_POWER_ON = 0x60,
	SP1K_MSG_POWER_OFF = 0x61,

	/* still playback */
	
	SP1K_MSG_STILLPLAY_DONE = 0x70,
	SP1K_MSG_MULTIPLAY_DONE = 0x71,
	SP1K_MSG_MULTIPLAY_SHIFT = 0x72,
	SP1K_MSG_IMGEDIT_DONE = 0x73,
	SP1K_MSG_RESPLAY_DONE = 0x74,
	
	/* media msg */
	
	SP1K_MSG_MEDIA_REC_OK = 0x80,
	SP1K_MSG_MEDIA_REC_FAIL = 0x81,
	SP1K_MSG_MEDIA_REC_DISK_FULL = 0x82,
	SP1K_MSG_MEDIA_PLAY_OK = 0x83,
	SP1K_MSG_MEDIA_PLAY_FAIL = 0x84,
	SP1K_MSG_MEDIA_PLAY_END = 0x85,
	SP1K_MSG_MEDIA_FF_TO_END = 0x86,
	SP1K_MSG_MEDIA_RW_TO_END = 0x87,
	SP1K_MSG_MEDIA_SOUND_FINISH = 0x88,
	SP1K_MSG_MEDIA_PLAY_START = 0x89,
	SP1K_MSG_MEDIA_REC_START = 0x8a,
	SP1K_MSG_MEDIA_REC_STOP = 0x8b,
	SP1K_MSG_MEDIA_VOICE_MEMO_END = 0x8c,

	/* misc control */

	SP1K_MSG_KEY_PRESS_SELFSNAP = 0x90,
	SP1K_MSG_SELFSNAP_BEEP = 0x91,
	SP1K_MSG_CMD_PANEL_OFF = 0x92,
	SP1K_MSG_CMD_PANEL_ON = 0x93,
	SP1K_MSG_3A_WAIT_PROC = 0x94,

	/* disk msg */
	
	SP1K_MSG_CARD_ERROR = 0xa0,
	SP1K_MSG_NAND_ERROR = 0xa1,
	SP1K_MSG_CARD_NOT_SUPPORT = 0xa2,

	/* slide show msg */
	
	SP1K_MSG_SLIDE_SHOW_START = 0xb0,
	SP1K_MSG_SLIDE_SHOW_STOP = 0xb1,
	SP1K_MSG_SLIDE_SHOW_NEXT = 0xb2,
	SP1K_MSG_SLIDE_SHOW_FINISH = 0xb3,

	/* DPS */
	SP1K_MSG_DPS_NEW_CONFIG_PRINTER = 0xc0,
	SP1K_MSG_DPS_NEW_DEVICE_STATUS = 0xc1,
	SP1K_MSG_DPS_NEW_JOB_STATUS = 0xc2,
	SP1K_MSG_DPS_START_JOB = 0xc3,
	SP1K_MSG_DPS_ERROR = 0xc4,
	
	/* os msg end */
	
	SP1K_MSG_OS_END = 0xcf,
} osMsgList_t;

/**************************************************************************
 *                         G L O B A L    D A T A                         *
 **************************************************************************/

/**************************************************************************
 *                 E X T E R N A L    R E F E R E N C E S                 *
 **************************************************************************/
 
/**************************************************************************
 *               F U N C T I O N    D E C L A R A T I O N S               *
 **************************************************************************/
void osMsgInit (void);
UINT8 osMsgQuery (void);
UINT8 osMsgAccept (UINT8* msg);
UINT8 osMsgPost (UINT8 msg);
UINT8 osMsgPostFront (UINT8 msg);	
UINT8 osMsgPostForce (UINT8 msg);
UINT8 osMsgWait(msg);
void osMsgFlush (void);
UINT8 osMsgSeek(UINT8 msg);
void osMsgLock (UINT8 bLock);
#endif /*__OS_MSG_H__*/

